home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / LocationManager.p < prev    next >
Encoding:
Text File  |  1997-08-12  |  10.2 KB  |  319 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        LocationManager.p
  3.  
  4.      Contains:    LocationManager (manage preferences for different physical Locations)
  5.  
  6.      Version:    Technology:    System 7.6
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1995-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT LocationManager;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __LOCATIONMANAGER__}
  28. {$SETC __LOCATIONMANAGER__ := 1}
  29.  
  30. {$I+}
  31. {$SETC LocationManagerIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __APPLEEVENTS__}
  35. {$I AppleEvents.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __COMPONENTS__}
  38. {$I Components.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __DIALOGS__}
  41. {$I Dialogs.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __PROCESSES__}
  44. {$I Processes.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __STANDARDFILE__}
  47. {$I StandardFile.p}
  48. {$ENDC}
  49.  
  50.  
  51. {$PUSH}
  52. {$ALIGN MAC68K}
  53. {$LibExport+}
  54.  
  55. {  Location Manager API Support --------------------------------------------------------------------  }
  56. {  A Location Token uniquely identifies a Location on a machine...  }
  57.  
  58.  
  59. TYPE
  60.     ALMToken = ^LONGINT;
  61.  
  62. CONST
  63.     kALMNoLocationToken            = -1;                            {  ALMToken of "off" Location... }
  64.  
  65.     kALMLocationNameMaxLen        = 31;                            {  name (actually imposed by file system)...  }
  66.     kALMMaxLocations            = 16;                            {  arbitrary limit enforced by Location Manager...  }
  67.     kALMNoLocationIndex            = -1;                            {  index for the "off" Location (kALMNoLocationToken)...  }
  68.  
  69.  
  70. TYPE
  71.     ALMLocationName                        = Str31;
  72. {  Returned from ALMConfirmName...  }
  73.     ALMConfirmChoice                    = SInt16;
  74.  
  75. CONST
  76.     kALMConfirmRename            = 1;
  77.     kALMConfirmReplace            = 2;
  78.  
  79. {  ALMConfirmName dialog item numbers for use in callbacks (ALM 2.0)...  }
  80.  
  81.     kALMDuplicateRenameButton    = 1;                            {  if Window refcon is kALMDuplicateDialogRefCon...  }
  82.     kALMDuplicateReplaceButton    = 2;
  83.     kALMDuplicateCancelButton    = 3;
  84.     kALMDuplicatePromptText        = 5;
  85.  
  86.     kALMRenameRenameButton        = 1;                            {  if Window refcon is kALMRenameDialogRefCon...  }
  87.     kALMRenameCancelButton        = 2;
  88.     kALMRenameEditText            = 3;
  89.     kALMRenamePromptText        = 4;
  90.  
  91. {  Refcons of two windows in ALMConfirmName (ALM 2.0)...  }
  92.  
  93.     kALMDuplicateDialogRefCon    = 'dupl';
  94.     kALMRenameDialogRefCon        = 'rnam';
  95.  
  96. {  Callback routine for Location awareness (mimics AppleEvents) in non-application code...  }
  97.  
  98.  
  99. TYPE
  100.     ALMNotificationProcPtr = ProcPtr;  { PROCEDURE ALMNotification(VAR theEvent: AppleEvent); }
  101.  
  102.     ALMNotificationUPP = UniversalProcPtr;
  103.  
  104. CONST
  105.     uppALMNotificationProcInfo = $000000C0;
  106.  
  107. FUNCTION NewALMNotificationProc(userRoutine: ALMNotificationProcPtr): ALMNotificationUPP;
  108.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  109.     INLINE $2E9F;
  110.     {$ENDC}
  111.  
  112. PROCEDURE CallALMNotificationProc(VAR theEvent: AppleEvent; userRoutine: ALMNotificationUPP);
  113.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  114.     INLINE $205F, $4E90;
  115.     {$ENDC}
  116. {  Notification AppleEvents sent to apps/registered code...   }
  117.  
  118. CONST
  119.     kAELocationChangedNoticeKey    = 'walk';                        {  Current Location changed...  }
  120.     kAELocationRescanNoticeKey    = 'trip';                        {  Location created/renamed/deleted...  }
  121.  
  122. {  ALMSwitchToLocation masks...  }
  123.  
  124.  
  125. TYPE
  126.     ALMSwitchActionFlags                = SInt32;
  127.  
  128. CONST
  129.     kALMDefaultSwitchFlags        = $00000000;                    {  No special action to take...  }
  130.     kALMDontShowStatusWindow    = $00000001;                    {  Suppress "switching" window...  }
  131.     kALMSignalViaAE                = $00000002;                    {  Switch by sending Finder AppleEvent...  }
  132.  
  133. {  Parameters for Get/Put/Merge Location calls...  }
  134.  
  135.  
  136. TYPE
  137.     ConstALMModuleTypeListPtr            = ^OSType;
  138.  
  139. CONST
  140.     kALMAddAllOnSimple            = 0;                            {  Add all single-instance, non-action modules...  }
  141.     kALMAddAllOff                = -1;                            {  Add all modules but turn them off...  }
  142.  
  143. {  Item numbers for use in Get/Put/Merge Location filters...  }
  144.  
  145.     kALMLocationSelectButton    = 1;
  146.     kALMLocationCancelButton    = 2;
  147.     kALMLocationBalloonHelp        = 3;
  148.     kALMLocationLocationList    = 7;
  149.     kALMLocationLocationNameEdit = 10;
  150.     kALMLocationPromptText        = 11;
  151.  
  152.     kALMLocationSaveButton        = 1;
  153.  
  154. {  Location Manager Module API Support -------------------------------------------------------------  }
  155.  
  156. {  ALMGetScriptInfo stuff...  }
  157.  
  158.     kALMScriptInfoVersion        = 2;                            {  Customarily put in resource for localization...  }
  159.  
  160.  
  161. TYPE
  162.     ALMScriptManagerInfoPtr = ^ALMScriptManagerInfo;
  163.     ALMScriptManagerInfo = RECORD
  164.         version:                SInt16;                                    {  Set to kALMScriptInfoVersion...  }
  165.         scriptCode:                SInt16;
  166.         regionCode:                SInt16;
  167.         langCode:                SInt16;
  168.         fontNum:                SInt16;
  169.         fontSize:                SInt16;
  170.     END;
  171.  
  172. {
  173.    Alternate form of ScriptInfo is easier to localize in resources; it is used extensively in
  174.    samples and internally, so....
  175. }
  176.     ALMAltScriptManagerInfoPtr = ^ALMAltScriptManagerInfo;
  177.     ALMAltScriptManagerInfo = RECORD
  178.         version:                SInt16;
  179.         scriptCode:                SInt16;
  180.         regionCode:                SInt16;
  181.         langCode:                SInt16;
  182.         fontSize:                SInt16;
  183.         fontName:                Str63;
  184.     END;
  185.  
  186.     ALMAltScriptManagerInfoHandle        = ^ALMAltScriptManagerInfoPtr;
  187.  
  188. CONST
  189.     kALMAltScriptManagerInfoRsrcType = 'trip';
  190.     kALMAltScriptManagerInfoRsrcID = 0;
  191.  
  192. {  Reboot information used on ALMSetCurrent (input/output parameter)...  }
  193.  
  194.  
  195. TYPE
  196.     ALMRebootFlags                        = UInt32;
  197.  
  198. CONST
  199.     kALMNoChange                = 0;
  200.     kALMAvailableNow            = 1;
  201.     kALMFinderRestart            = 2;
  202.     kALMProcesses                = 3;
  203.     kALMExtensions                = 4;
  204.     kALMWarmBoot                = 5;
  205.     kALMColdBoot                = 6;
  206.     kALMShutdown                = 7;
  207.  
  208. {
  209.    File types and signatures...
  210.    Note: auto-routing of modules will not be supported for 'thng' files...
  211. }
  212.  
  213.     kALMFileCreator                = 'fall';                        {  Creator of Location Manager files...  }
  214.     kALMComponentModuleFileType    = 'thng';                        {  Type of a Component Manager Module file [v1.0]...  }
  215.     kALMComponentStateModuleFileType = 'almn';                    {  Type of a CM 'state' Module file...  }
  216.     kALMComponentActionModuleFileType = 'almb';                    {  Type of a CM 'action' Module file...  }
  217.     kALMCFMStateModuleFileType    = 'almm';                        {  Type of a CFM 'state' Module file...  }
  218.     kALMCFMActionModuleFileType    = 'alma';                        {  Type of a CFM 'action' Module file...  }
  219.  
  220. {  Component Manager 'thng' info...  }
  221.  
  222.     kALMComponentRsrcType        = 'thng';
  223.     kALMComponentType            = 'walk';
  224.  
  225. {  CFM Modules require a bit of information (replacing some of the 'thng' resource)...  }
  226.  
  227.     kALMModuleInfoRsrcType        = 'walk';
  228.     kALMModuleInfoOriginalVersion = 0;
  229.  
  230. {  These masks apply to the "Flags" field in the 'thng' or 'walk' resource...  }
  231.  
  232.     kALMMultiplePerLocation        = $00000001;                    {  Module can be added more than once to a Location...  }
  233.     kALMDescriptionGetsStale    = $00000002;                    {  Descriptions may change though the setting didn't...   }
  234.  
  235. {  Misc stuff for older implementations ------------------------------------------------------------  }
  236.  
  237. {$IFC OLDROUTINENAMES }
  238. {  Old error codes for compatibility - new names are in Errors interface...  }
  239.     ALMInternalErr                = -30049;                        {  use kALMInternalErr  }
  240.     ALMLocationNotFound            = -30048;                        {  use kALMLocationNotFoundErr  }
  241.     ALMNoSuchModuleErr            = -30047;                        {  use kALMNoSuchModuleErr  }
  242.     ALMModuleCommunicationErr    = -30046;                        {  use kALMModuleCommunicationErr  }
  243.     ALMDuplicateModuleErr        = -30045;                        {  use kALMDuplicateModuleErr  }
  244.     ALMInstallationErr            = -30044;                        {  use kALMInstallationErr  }
  245.     ALMDeferSwitchErr            = -30043;                        {  use kALMDeferSwitchErr  }
  246.  
  247. {  Old ALMConfirmName constants...  }
  248.  
  249.     ALMConfirmRenameConfig        = 1;
  250.     ALMConfirmReplaceConfig        = 2;
  251.  
  252. {  Old AppleEvents...  }
  253.  
  254.     kAELocationNotice            = 'walk';
  255.  
  256.  
  257. TYPE
  258.     ALMScriptMgrInfo                    = ALMScriptManagerInfo;
  259.     ALMScriptMgrInfoPtr                 = ^ALMScriptMgrInfo;
  260.     ALMComponentFlagsEnum                = UInt32;
  261. {$ENDC}  {OLDROUTINENAMES}
  262.  
  263. {  Location Manager API ----------------------------------------------------------------------------  }
  264.  
  265. {  The following 7 routines are present if gestaltALMAttr has bit gestaltALMPresent set...  }
  266.  
  267. FUNCTION ALMGetCurrentLocation(VAR index: SInt16; VAR token: ALMToken; VAR name: ALMLocationName): OSErr;
  268.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  269.     INLINE $303C, $0600, $AAA4;
  270.     {$ENDC}
  271. FUNCTION ALMGetIndLocation(index: SInt16; VAR token: ALMToken; VAR name: ALMLocationName): OSErr;
  272.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  273.     INLINE $303C, $0501, $AAA4;
  274.     {$ENDC}
  275. FUNCTION ALMCountLocations(VAR locationCount: SInt16): OSErr;
  276.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  277.     INLINE $303C, $0202, $AAA4;
  278.     {$ENDC}
  279. FUNCTION ALMSwitchToLocation(newLocation: ALMToken; switchFlags: ALMSwitchActionFlags): OSErr;
  280.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  281.     INLINE $303C, $0403, $AAA4;
  282.     {$ENDC}
  283. FUNCTION ALMRegisterNotifyProc(notificationProc: ALMNotificationUPP; {CONST}VAR whichPSN: ProcessSerialNumber): OSErr;
  284.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  285.     INLINE $303C, $0404, $AAA4;
  286.     {$ENDC}
  287. FUNCTION ALMRemoveNotifyProc(notificationProc: ALMNotificationUPP; {CONST}VAR whichPSN: ProcessSerialNumber): OSErr;
  288.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  289.     INLINE $303C, $0405, $AAA4;
  290.     {$ENDC}
  291. FUNCTION ALMConfirmName(message: ConstStr255Param; VAR theName: Str255; VAR choice: ALMConfirmChoice; filter: ModalFilterUPP): OSErr;
  292.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  293.     INLINE $303C, $0806, $AAA4;
  294.     {$ENDC}
  295. {  The following 3 routines are present if gestaltALMAttr has bit gestaltALMHasSFLocation set...  }
  296.  
  297. FUNCTION ALMPutLocation(prompt: ConstStr255Param; VAR name: ALMLocationName; numTypes: SInt16; typeList: ConstALMModuleTypeListPtr; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  298.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  299.     INLINE $303C, $0B07, $AAA4;
  300.     {$ENDC}
  301. FUNCTION ALMGetLocation(prompt: ConstStr255Param; VAR name: ALMLocationName; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  302.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  303.     INLINE $303C, $0808, $AAA4;
  304.     {$ENDC}
  305. FUNCTION ALMMergeLocation(prompt: ConstStr255Param; VAR name: ALMLocationName; numTypes: SInt16; typeList: ConstALMModuleTypeListPtr; filter: ModalFilterYDUPP; yourDataPtr: UNIV Ptr): OSErr;
  306.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  307.     INLINE $303C, $0B09, $AAA4;
  308.     {$ENDC}
  309. {$ALIGN RESET}
  310. {$POP}
  311.  
  312. {$SETC UsingIncludes := LocationManagerIncludes}
  313.  
  314. {$ENDC} {__LOCATIONMANAGER__}
  315.  
  316. {$IFC NOT UsingIncludes}
  317.  END.
  318. {$ENDC}
  319.